
const SoundType = require("SoundType");

cc.Class({
    extends: cc.Component,
    properties: {

        backgroundMusic:{
            default:null,
            type:cc.AudioClip,
        },

        flySound:{
            type:cc.AudioClip,
            default:null,
        },

        scoreSound:{
            type:cc.AudioClip,
            default:null,
        },

        dieSound:{
            type:cc.AudioClip,
            default:null,
        },
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

        // cc.audioEngine.playMusic(this.backgroundMusic,true);
    },

    playSound(type){

        if(type == SoundType.E_SOUND_FLY){
            cc.audioEngine.playEffect(this.flySound,false);
        }
        else if(type == SoundType.E_SOUND_SCORE){
            cc.audioEngine.playEffect(this.scoreSound,false);
        }
        else if(type == SoundType.E_SOUND_DIE){
            cc.audioEngine.playEffect(this.dieSound,false);
        }
    }
    // update (dt) {},
});
